﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KingSite.SyncDB.Repository;
using System.Threading;
using KingSite.SyncDB.Core.Repository;
using KingSite.SyncDB.Core.Entity;


namespace KingSite.SyncDB {
    public class SyncJob {
        SyncRepository sr = new SyncRepository();

        public void Do() {
            //获得需要执行的同步任务
            IList<SyncJobInfo> jobList = sr.GetAllSyncJob();
            //为每个任务启动一个线程来处理
            foreach (SyncJobInfo job in jobList) {
                SyncJobDetail jd = new SyncJobDetail(job);
                Thread tjob = new Thread(new ThreadStart(jd.RunJob));
                tjob.Start();
                //jd.RunJob();                
            }
        }


    }
}
